package site.codeblog.designpattern.factory.after;

public class CoffeeFactory {

    public static Coffee createCoffee(String type){

        Coffee coffee = null;

        if ("black".equals(type)) {

            coffee = new BlackCoffee();

        } else if ("milk".equals(type)) {

            coffee = new MilkCoffee();

        } else {
            throw new RuntimeException("没有这种咖啡");
        }
        return coffee;
    }

}
